import React, { useState, useEffect } from 'react';
import PatentHeatmap from '../components/PatentHeatmap';
import { API_CONFIG } from '../config';

const TrendAnalysis = () => {
  const [heatmapData, setHeatmapData] = useState<{imageUrl: string}>();

  useEffect(() => {
    fetch(`${API_CONFIG.BASE_URL}/api/v1/trend/industry/1/heatmap`)
      .then(res => res.json())
      .then(res => {
        if (res.code === 200) {
          setHeatmapData(res.data);
        }
      });
  }, []);

  return (
    <div>
      {heatmapData && (
        <PatentHeatmap imageUrl={heatmapData.imageUrl} />
      )}
    </div>
  );
};

export default TrendAnalysis; 